/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.route.system.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author neco
 */
@Entity
@Table(name = "rps_route_stations", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RpsRouteStations.findAll", query = "SELECT r FROM RpsRouteStations r"),
    @NamedQuery(name = "RpsRouteStations.findByStationsId", query = "SELECT r FROM RpsRouteStations r WHERE r.stationsId = :stationsId"),
    @NamedQuery(name = "RpsRouteStations.findByStationsOrder", query = "SELECT r FROM RpsRouteStations r WHERE r.stationsOrder = :stationsOrder"),
    @NamedQuery(name = "RpsRouteStations.findByStationsDistanceToNextStation", query = "SELECT r FROM RpsRouteStations r WHERE r.stationsDistanceToNextStation = :stationsDistanceToNextStation"),
    @NamedQuery(name = "RpsRouteStations.findByStationsLatitude", query = "SELECT r FROM RpsRouteStations r WHERE r.stationsLatitude = :stationsLatitude"),
    @NamedQuery(name = "RpsRouteStations.findByStationsLongtitude", query = "SELECT r FROM RpsRouteStations r WHERE r.stationsLongtitude = :stationsLongtitude"),
    @NamedQuery(name = "RpsRouteStations.findByStationsStationType", query = "SELECT r FROM RpsRouteStations r WHERE r.stationsStationType = :stationsStationType")})
public class RpsRouteStations implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "stations_id", nullable = false)
    private Integer stationsId;
    @Column(name = "stations_order")
    private Integer stationsOrder;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "stations_distance_to_next_station", precision = 17, scale = 17)
    private Double stationsDistanceToNextStation;
    @Size(max = 20)
    @Column(name = "stations_latitude", length = 20)
    private String stationsLatitude;
    @Size(max = 20)
    @Column(name = "stations_longtitude", length = 20)
    private String stationsLongtitude;
    @Column(name = "stations_station_type")
    private Integer stationsStationType;
    @JoinColumn(name = "stations_station", referencedColumnName = "station_id")
    @ManyToOne
    private RpsStation stationsStation;
    @JoinColumn(name = "stations_route_description", referencedColumnName = "description_id")
    @ManyToOne
    private RpsRouteDescription stationsRouteDescription;
    @OneToMany(mappedBy = "dataRouteStations")
    private List<RpsTrafficData> rpsTrafficDataList;

    public RpsRouteStations() {
    }

    public RpsRouteStations(Integer stationsId) {
        this.stationsId = stationsId;
    }

    public Integer getStationsId() {
        return stationsId;
    }

    public void setStationsId(Integer stationsId) {
        this.stationsId = stationsId;
    }

    public Integer getStationsOrder() {
        return stationsOrder;
    }

    public void setStationsOrder(Integer stationsOrder) {
        this.stationsOrder = stationsOrder;
    }

    public Double getStationsDistanceToNextStation() {
        return stationsDistanceToNextStation;
    }

    public void setStationsDistanceToNextStation(Double stationsDistanceToNextStation) {
        this.stationsDistanceToNextStation = stationsDistanceToNextStation;
    }

    public String getStationsLatitude() {
        return stationsLatitude;
    }

    public void setStationsLatitude(String stationsLatitude) {
        this.stationsLatitude = stationsLatitude;
    }

    public String getStationsLongtitude() {
        return stationsLongtitude;
    }

    public void setStationsLongtitude(String stationsLongtitude) {
        this.stationsLongtitude = stationsLongtitude;
    }

    public Integer getStationsStationType() {
        return stationsStationType;
    }

    public void setStationsStationType(Integer stationsStationType) {
        this.stationsStationType = stationsStationType;
    }

    public RpsStation getStationsStation() {
        return stationsStation;
    }

    public void setStationsStation(RpsStation stationsStation) {
        this.stationsStation = stationsStation;
    }

    public RpsRouteDescription getStationsRouteDescription() {
        return stationsRouteDescription;
    }

    public void setStationsRouteDescription(RpsRouteDescription stationsRouteDescription) {
        this.stationsRouteDescription = stationsRouteDescription;
    }

    @XmlTransient
    public List<RpsTrafficData> getRpsTrafficDataList() {
        return rpsTrafficDataList;
    }

    public void setRpsTrafficDataList(List<RpsTrafficData> rpsTrafficDataList) {
        this.rpsTrafficDataList = rpsTrafficDataList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (stationsId != null ? stationsId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RpsRouteStations)) {
            return false;
        }
        RpsRouteStations other = (RpsRouteStations) object;
        if ((this.stationsId == null && other.stationsId != null) || (this.stationsId != null && !this.stationsId.equals(other.stationsId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.route.system.entity.RpsRouteStations[ stationsId=" + stationsId + " ]";
    }
    
}
